package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.PaasFormServiceModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.PaasFormServiceDao;
import com.xbongbong.pro.domain.entity.PaasFormServiceEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:20
 */
@Service("paasFormServiceModel")
public class PaasFormServiceModelImpl implements PaasFormServiceModel {

    @Resource
    private PaasFormServiceDao paasFormServiceDao;

    @Override
    public Integer insert(PaasFormServiceEntity entity) throws XbbException {
        long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return paasFormServiceDao.insert(entity);
    }

    @Override
    public Integer update(PaasFormServiceEntity entity) throws XbbException {
        long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return paasFormServiceDao.update(entity);
    }

    @Override
    public List<PaasFormServiceEntity> findEntitys(Map<String, Object> param) {
        return paasFormServiceDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return paasFormServiceDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer deleteBatch(List<Long> deleteList, String corpid) {
        return paasFormServiceDao.deleteBatch(deleteList, corpid);
    }

    @Override
    public Integer addBatch(List<PaasFormServiceEntity> addList) {
        return paasFormServiceDao.insertBatch(addList);
    }

    @Override
    public Integer updateBatch(List<PaasFormServiceEntity> updateList, String corpid) {
        return paasFormServiceDao.updateBatch(updateList, corpid);
    }

    @Override
    public Integer deleteByFormId(Long formId, String corpid, Integer businessType) {
        return paasFormServiceDao.deleteByFormId(formId, corpid, businessType);
    }
}
